package com.cy.dda.dao.mapper.collection;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.cy.dda.model.domain.collection.CollectionRecord;
import com.cy.dda.model.query.collection.CollectionRecordListAdminQuery;
import com.cy.dda.model.query.collection.CollectionRecordListQuery;
import com.cy.dda.model.vo.collection.CollectionRecordDetailInfoAdminVO;
import com.cy.dda.model.vo.collection.CollectionRecordListAdminVO;
import com.cy.dda.model.vo.collection.CollectionRecordListVO;
import com.cy.dda.model.vo.statistics.StatisticsCollectionRecordVO;
import com.cy.dda.model.vo.user.UserIndexCollectionRecordInfoVO;

import tk.mybatis.mapper.common.BaseMapper;

/**
 * CollectionRecord
 *
 * @author: tanyilin
 * @create: 2018年11月2日 下午4:05:12
 */
@Mapper
public interface CollectionRecordMapper extends BaseMapper<CollectionRecord> {

	/**
	 * 查询，后台催收记录总条数
	 * 
	 * @param query
	 * @return
	 */
	int selectCollectionRecordListAdminCount(CollectionRecordListAdminQuery query);
	
	/**
	 * 查询，后台催收记录列表
	 * 
	 * @param query
	 * @return
	 */
	List<CollectionRecordListAdminVO> selectCollectionRecordListAdmin(CollectionRecordListAdminQuery query);
	
	/**
	 * 后台-查询催收记录信息详情
	 * 
	 * @param collectionRecordId
	 * @return
	 */
	CollectionRecordDetailInfoAdminVO selectCollectionRecordDetailInfoAdminVO(@Param("collectionRecordId") Long collectionRecordId);
	
	/**
	 * 查询前台用户首页最近催收记录
	 * 
	 * @param userId
	 * @return
	 */
	List<UserIndexCollectionRecordInfoVO> selectUserIndexCollectionRecordInfoVO(@Param("userId") Long userId);
	
	/**
	 * 查询，前台催收记录总条数
	 * 
	 * @param query
	 * @return
	 */
	int selectCollectionRecordListCount(CollectionRecordListQuery query);
	
	/**
	 * 查询，前台催收记录列表
	 * 
	 * @param query
	 * @return
	 */
	List<CollectionRecordListVO> selectCollectionRecordList(CollectionRecordListQuery query);
	
	/**
	 * 根据催收员用户ID，统计近n天的催收日志数量
	 * 
	 * @param userId
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	List<StatisticsCollectionRecordVO> selectStatisticsCollectionRecordVO(@Param("userId") Long userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
	
}
